home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------*
- | |
- | <<< PStrings.h - Pascal string routines >>> |
- | |
- *---------------------------------------------------------------------------*/
-
- /* This file contains:
-
- PStr_Length(s) - length of Pascal string
- PStr_Set(destS, srcS) - assign one Pascal string to another
- PStr_Cmp(s1, s2) - Compare two Pascal strings
- PStr_Pos(sub, src) - Position from left of substring in source string
- PStr_Copy(dst, src, amount) - Copy src string chars to dst and form a string
- PStr_Insert(dst, ins, start) - Insert a string into another
- PStr_Delete(dst, start, amount) - Delete characters from a string
- PStr_Concat(dst, s1,...,NULL) - Concat arbitrary number of strings
-
- */
-
- #ifndef __PSTRINGS__
- #define __PSTRINGS__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __STRING__
- #include <String.h>
- #endif
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #define PStr_Length(s) (*(unsigned char *)(s))
-
- extern void PStr_Set(unsigned char *destS, unsigned char *srcS);
- /*
- Assigns value of second string to first.
- */
-
- extern short PStr_Cmp(unsigned char *s1, unsigned char *s2);
- /*
- Compares the contents of two Pascal strings and returns <0 if s1 < s2, 0 if
- s1 == s2, and >0 if s1 > s2.
- */
-
-
- extern short PStr_Pos(unsigned char *sub, unsigned char *src);
- /*
- Find the first occurrence of Pascal string sub in the Pascal string src and
- return the index of the first occurrence.
- */
-
-
- extern unsigned char *PStr_Copy(unsigned char *dst, unsigned char *src,
- int startPos, int amount);
- /*
- Copy amount characters (or up to the last character of the src Pascal string)
- from the src Pascal string starting at startPos in src to the dst Pascal string
- and return a pointer to the dst Pascal string. It is up to the caller to make
- sure enough space is reserved in the dst string.
- */
-
-
- extern unsigned char *PStr_Insert(unsigned char *dst, unsigned char *ins,
- int startPos);
- /*
- Insert the ins Pascal string into the dst string starting at position
- startPos in the dst string. The function returns original dst
- Pascal string with the insert as its value. It is up to the caller to make
- sure enough space is reserved in the dst string for the insertion.
- */
-
-
- extern unsigned char *PStr_Delete(unsigned char *dst, int startPos, int amount);
- /*
- Delete amount characters (or all remaining characters) from the Pascal string
- starting at the character indicated by startPos.
- */
-
-
- extern unsigned char *PStr_Concat(unsigned char *dst, unsigned char *src1, .../*, NULL*/);
- /*
- Concatenate all the Pascal strings specified in the argument list together
- with the dst Pascal string and return a pointer to the dst string. It is up
- to the caller to make sure enough space is reserved in the dst string for all
- the concatenations. No check is made to see that the string length exceeds
- 255 characters.
- */
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-